<?php

namespace api\web\validate;

use think\Validate;

class UserValidate extends Validate
{
    protected $rule = [
        'mobile' => 'require|length:11',
        'code' => 'require|length:4',
        'password' => 'min:6|max:32'
    ];

    protected $message = [
        'mobile.require' => '手机号不能为空',
        'mobile.length' => '手机号必须为11位',
        'mobile.unique' => '手机号重复使用',
        'password.min' => '密码长度不能小于6位',
        'password.max' => '密码长度不能超过32位',
        'code.require' => '验证码不能为空',
        'code.length' => '验证码必须为4位',
    ];

    protected $scene = [
        'register' => ['mobile' => 'require|length:11|unique:register', 'code',],
        'login' => ['mobile', 'code'],
        'sendsms' => ['mobile' => 'require|length:11'],
    ];
}